<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <!-- <script src="./jquery-1.9.1.min.js"></script> -->
    <script src="./ajax.js"></script>
    <!-- <script src="./answerajax.js"></script> -->
    <script>
        /*
        data：客户端传递给服务器数据。但是做了很多处理。如果是get请求是数据基于问号？传参。
        如果是post传参，是基于post请求主体传给服务器xhr.send('xxx=xxx&xxx=xxx')
        */

        ajax({
            // method: 'post',
            type: 'GET',
            url: 'https://www.easy-mock.com/mock/5b0412beda8a195fb0978627/temp/list',
            data: { name: 'zs', age: 10 },
            dataType: 'json',
            async: true,
            cache: false,
            success: function (data) {
                console.log(data)
            },
            error: function (reason) {
                console.log(reason)
            }
        })


    </script>
</body>

</html>